package com.lepu.app.main.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class BeanFocus implements Serializable {

	private static final long serialVersionUID = 8296257066916405589L;
	
	public String ArticleID;
	public String ArticleTitle;
	public String ArticleDescription;
	public String ACID;
	public String ACTitle;
	
	public String PublishDate;
	public String LinkURL;
	public String Cover;
	
	public String Video;
	public String LinkTargetType;
	public String LinkTargetID;
	public String ViewCount;
	public String FavourCount;

	public String ArticleContent;//文章详情
	

	public static ArrayList<BeanFocus> parseJsonData(String dataString) {
		String result = "";
		try {
			JSONObject jsonObject = new JSONObject(dataString);
			JSONObject obj1 = (JSONObject) jsonObject.get("Result");
			JSONArray dataArray = (JSONArray) obj1.get("ListInfo");
			
			result = dataArray.toString();
		} catch (JSONException e) {
			e.printStackTrace();
		}

		Gson gson = new Gson();
		ArrayList<BeanFocus> testArraylist = gson.fromJson(result,
				new TypeToken<List<BeanFocus>>() {
				}.getType());
		return testArraylist;
	}
	
	public static BeanFocus parseSimpleData(String dataString) {
		String result = "";
		try {
			JSONObject jsonObject = new JSONObject(dataString);
			JSONObject obj1 = (JSONObject) jsonObject.get("Result");
			JSONObject obj2 = (JSONObject) obj1.get("DetailInfo");
			
			result = obj2.toString();
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		Gson gson = new Gson();
		BeanFocus item = gson.fromJson(result,
				new TypeToken<BeanFocus>() {
				}.getType());
		return item;
	}
}
